<script src="/static/admin/js/jquery-1.8.1.min.js"></script>
<!-- 右 -->
<div class="content">
    <div class="header">
        <h1 class="page-title">商品属性修改</h1>
    </div>

    <div class="well">
        <!-- edit form -->
        <form id="tab" action="{:url('/admin/attribute/update')}" method="post">
            <input type="hidden" name="id" value="{$data.id}">
            {:token()}
            <label>属性名称：</label>
            <input type="text" name="attr_name" value="{$data.attr_name}" class="input-xlarge">
            <label>商品类型：</label>
            <select name="type_id" class="dfinput">
                <option value="0">--请选择--</option>
                {foreach $type as $v}
                    <option  value="{$v.id}"  {if($v.id == $data.type_id)} selected {/if}>{$v.type_name}</option>
                {/foreach}
            </select>

            <label>属性类型：</label>
            <span>
                {if $data.attr_type == 0}
                    <input type="radio" name="attr_type" value="0" checked="checked">唯一属性&emsp;
                {elseif $data.attr_type == 1 /}
                    <input type="radio" name="attr_type" value="1" checked="checked">单选属性
                {/if}
            </span>
            <label>录入方式：</label>
            <span class="input_type">
                {if $data.attr_input_type == 0}
                    <input type="radio" name="attr_input_type" value="0" checked="checked">输入框&emsp;
                    <input type="radio" name="attr_input_type" value="1">下拉列表
                {elseif $data.attr_input_type == 1 /}
                    <input type="radio" name="attr_input_type" value="0">输入框&emsp;
                    <input type="radio" name="attr_input_type" value="1" checked="checked">下拉列表
                {elseif $data.attr_input_type == 2 /}
                    <input type="radio" name="attr_input_type" value="2" checked="checked">多选框
                {/if}
            </span>
            <label>可选值：</label>
            <textarea name="attr_values" placeholder="请输入可选值，多个值之间请使用英文“,”分隔开" class="textinput">{$data.attr_values}</textarea>
            <label></label>
            <button class="btn btn-primary" type="submit">保存</button>
        </form>
    </div>
</div>
<script type="text/javascript">
    $(function(){
        $('input[name=attr_type]').change(function(){
            $('.input_type').toggleClass('hide');
        })
    })
</script>
